$(function() {
	var qx=getQxfromSession('qx3').split(",");
    var j=1;
    for(var i=0;i<qx.length;i++){
    	if(qx[i]=='01010801'){
			$('#aa').accordion('add', {
				id:"left_menu1",
				title: '项目资金调剂',
				selected: j==1?true:false,
				iconCls:'icon-none'
			});
			$("#left_menu1").append('<ul id="tree01010801"></ul>');
			createMenunew('01010801');
			j++;
		}
    	
    	if(qx[i]=='01010803'){
			$('#aa').accordion('add', {
				id:"left_menu3",
				title: '关联计划',
				selected: j==1?true:false,
				iconCls:'icon-none'
			});
			$("#left_menu3").append('<ul id="tree01010803"></ul>');
			createMenunew('01010803');
			j++;
		}
    	
    	
    	if(qx[i]=='01010804'){
			$('#aa').accordion('add', {
				id:"left_menu4",
				title: '计划滞后项目管理',
				selected: j==1?true:false,
				iconCls:'icon-none'
			});
			$("#left_menu4").append('<ul id="tree01010804"></ul>');
			createMenunew('01010804');
			j++;
		}
    	
    	if(qx[i]=='01010805'){
			$('#aa').accordion('add', {
				id:"left_menu5",
				title: '计划滞后项目关联',
				selected: j==1?true:false,
				iconCls:'icon-none'
			});
			$("#left_menu5").append('<ul id="tree01010805"></ul>');
			createMenunew('01010805');
			j++;
		}
    	
    }
	
	menuQx();
	
});


function menuQx(){
	var qx=selQxByUser2(parent.$.cookie("roleid"));//parent.$.cookie("qx4").split(",");
	for(var i=0;i<qx.length;i++){
		if($("#menu_"+qx[i])!=null) $("#menu_"+qx[i]).show();
	}
}


function selQxByUser2(roleid){
	var qx4= new Array();
	$.ajax({
		type : "POST",
		url : "../../xtgl/selQxByUser2.do",
		dataType : 'json',
		data :"param.roleid="+roleid,
		async: false ,
		success : function(msg){
			if(msg){
				for(var i=0;i<msg.length;i++){
					//第4层
					if(msg[i].id.length==10) qx4. push(msg[i].id);
				}
	     	 }
		 }
	});
	return qx4;
}

